﻿#include "scanruleservice.h"
#include <databasecenter.h>

ScanRuleService::ScanRuleService(QObject *parent) : QObject(parent)
{
    db = DatabaseCenter::getInstance()->getConnection();
}

ScanRuleService::~ScanRuleService()
{
    DatabaseCenter::getInstance()->releaseConnection(db);
}

bool ScanRuleService::getList(QList<ScanRule> &list)
{
    ScanRuleDao objectDao(db);
    return (objectDao.getList(list));
}

bool ScanRuleService::getOne(ScanRule &object)
{
    ScanRuleDao objectDao(db);
    return (objectDao.getOne(object));
}

bool ScanRuleService::saveOne(ScanRule &object)
{
    ScanRuleDao objectDao(db);
    return (objectDao.saveOne(object));
}

bool ScanRuleService::deleteOne(ScanRule &object)
{
    ScanRuleDao objectDao(db);
    return (objectDao.deleteOne(object));
}

QSqlDatabase ScanRuleService::getDb() const
{
    return db;
}
